package com.maple.common.utils

import java.util.Locale

/**
 * Tip:
 * Create by SeVen on 2024/4/22 20:06
 */
object LanguageUtil {
    /**
     * 返回当前系统语言
     * @return String
     */
    fun getLanguage(): String = Locale.getDefault().language

    /**
     * 返回当前系统国家
     * @return String
     */
    fun getCountry(): String = Locale.getDefault().country

    /**
     * 当前系统语言是否为阿拉伯语
     * @return Boolean
     */
    fun isArabicLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_AR

    /**
     * 当前系统语言是否为英语
     * @return Boolean
     */
    fun isEnglishLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_EN

    /**
     * 当前系统语言是否为西班牙语
     * @return Boolean
     */
    fun isSpanishLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_ES

    /**
     * 当前系统语言是否为法语
     * @return Boolean
     */
    fun isFranceLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_FR

    /**
     * 当前系统语言是否为海地语
     * @return Boolean
     */
    fun isHindiLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_HI

    /**
     * 当前系统语言是否为挪威语
     * @return Boolean
     */
    fun isNorwegianLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_NB

    /**
     * 当前系统语言是否为葡萄牙语
     * @return Boolean
     */
    fun isPortugueseLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_PT

    /**
     * 当前系统语言是否为泰语
     * @return Boolean
     */
    fun isThaiLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_TH

    /**
     * 当前系统语言是否为乌兹别克斯坦语
     * @return Boolean
     */
    fun isUzbekLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_UZ

    /**
     * 当前系统语言是否为中文
     * @return Boolean
     */
    fun isChineseLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_ZH

    /**
     * 当前系统语言是否为希伯来语
     * @return Boolean
     */
    fun isHebrewLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_IW

    /**
     * 当前系统语言是否为日语
     * @return Boolean
     */
    fun isJapaneseLanguage(): Boolean = getLanguage() == ConstCountryCode.LANGUAGE_JA
}

object ConstCountryCode {
    /**
     * 系统语言代号
     */
    const val LANGUAGE_DEFAULT = ""     //默认
    const val LANGUAGE_EN = "en"        //英语
    const val LANGUAGE_AR = "ar"        //阿拉伯语
    const val LANGUAGE_ES = "es"        //西班牙语
    const val LANGUAGE_FR = "fr"        //法语
    const val LANGUAGE_HI = "hi"        //印地语
    const val LANGUAGE_NB = "nb"        //挪威语
    const val LANGUAGE_PT = "pt"        //葡萄牙语
    const val LANGUAGE_TH = "th"        //泰语
    const val LANGUAGE_UZ = "uz"        //乌兹别克斯坦语
    const val LANGUAGE_ZH = "zh"        //中文
    const val LANGUAGE_IW = "iw"        //希伯来语
    const val LANGUAGE_JA = "ja"        //日语
}

/**
 * ASCII码值 自定义两边对齐文本框有用到
 */
object ConstCommon {
    const val EMPTY_LINE = 0
    const val ASCII_SPACE = 32 // ASCII码：空格
    const val ASCII_ENTER = 10 // ASCII码：换行符
    const val ASCII_FULL_STOP = 46 // ASCII码：句号
    const val ASCII_COMMA = 44 // ASCII码：句号
    const val ASCII_SINGLE_QUOTES = 39 // ASCII码：单引号
    const val ASCII_DOUBLE_QUOTES = 34 // ASCII码：双引号
    const val ASCII_NUM_ZERO = 48 // ASCII码：0
    const val ASCII_NUM_NINE = 57 // ASCII码：9
}